package API.ObjectsDemo;

import java.util.Objects;

/**
 * ClassName:Studnet
 * Package:API.ObjectsDemo
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/31-13:27
 * @Version:v1.0
 */
public class Studnet {
    private String name;
    private int age;

    public Studnet() {
    }

    public Studnet(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Studnet studnet = (Studnet) o;
        return age == studnet.age && Objects.equals(name, studnet.name);
    }

//    @Override
//    public int hashCode() {
//        return Objects.hash(name, age);
//    }

    public String toString() {
        return "学生的姓名："+name+" "+"年龄"+age;
    }
}
